To discard everything permanently: git reset --hard. Undo local commits. When you commit to your local repository with git commit , Git records your changes.
git reset --hard removes staged changes as well as working directory changes. Also, git clean -f -d is probably a better opposite of adding a new untracked ...
Learn all of the available 'undo' Git strategies and commands with this tutorial. Undo changes helps you work with previous revisions of a software project. Git Revert · Git Clean · Git Reset · Git RM